<template>
	<view>
		<input class="input-wx" type="nickname" :value="userName" placeholder="世界上没有昵称的"
				@focus="handleFocus"
				@blur="handleBlur"/>
	</view>
</template>

<script>
	import userApi from '../../api/user'
	
	export default {
		name:"WxNickname",
		data() {
			return {
				userName: null
			};
		},
		created() {
			var user = uni.getStorageSync('user')
			if (user != null) this.userName = user.userName
		},
		methods: {
			handleFocus(e) {
				console.log(e)
			},
			handleBlur(e) { //失去焦点时更改
				console.log(e)
				userApi.changeUserNickname(e.detail.value)
			}
		}
	}
</script>

<style scoped>
	.input-wx {
		width: 400rpx;
		font-size: 30rpx;
		padding: 10rpx;
		margin: 10rpx;
		cursor: none;
		color: black;
	}
</style>